package com.paolu.filestream;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class CreateDirectory {

    public CreateDirectory(){
        createDirectory();
    }

    private void createDirectory(){

        String directoryPath = "Ball/src/main/files";
        String timestamp = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
        String fileName = timestamp + ".txt";
        File directory = new File(directoryPath);
        File file = new File(directoryPath + "/" + fileName);

        try {
            if (!directory.exists()) {
                directory.mkdirs();
            }
            if (file.createNewFile()) {

            } else {

            }
        } catch (IOException e) {
            System.out.println("发生错误: " + e.getMessage());
        }

        new Input(file.getAbsolutePath());

    }

}
